package com.platform.action;

import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.platform.service.UserService;

@Namespace("/platform")
@Results({
	@Result(name="success",location="/jsp/platform/user.jsp"),
	@Result(name="input",location="/jsp/platform/user-input.jsp")
	})
public class UserAction extends ActionSupport {
	
	private static final long serialVersionUID = 0L;
	
	private UserService userService;

	@Autowired
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public String execute() throws Exception{
		System.out.println("userAction");
		String name = userService.getUser("1").getName();
		System.out.println(name);
		return "success";
	}

}
